<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SemOpt: Preferred Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">SemOpt
   &#160;<span id="projectnumber">0.2alpha5-SCC</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('classPreferred.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">Preferred Class Reference</div>  </div>
</div><!--header-->
<div class="contents">
<!-- doxytag: class="Preferred" -->
<p>use it to compute the algorithm prefSAT  
 <a href="classPreferred.html#details">More...</a></p>

<p><a href="classPreferred-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPreferred.html#af11979bfbee65a273e2f8a0a3112442c">Preferred</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">constructs a new instance computing prefSAT problems.  <a href="#af11979bfbee65a273e2f8a0a3112442c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPreferred.html#aa062709a818c1e9ae8ffeca02a3b0bd7">prefSAT</a> (<a class="el" href="classSetArguments.html">SetArguments</a> *, <a class="el" href="classSetArguments.html">SetArguments</a> *)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">compute the algorithm <a class="el" href="classPreferred.html#aa062709a818c1e9ae8ffeca02a3b0bd7" title="compute the algorithm prefSAT().">prefSAT()</a>.  <a href="#aa062709a818c1e9ae8ffeca02a3b0bd7"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">PreferredIterator&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPreferred.html#a4aa065773cf8c442997c93167efcfa80">begin</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">last element of the solution computed by the function prefSat().  <a href="#a4aa065773cf8c442997c93167efcfa80"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">PreferredIterator&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPreferred.html#a51a8c661f68c2f4b066752b32f06c131">end</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">last element of the solution computed by the function prefSat().  <a href="#a51a8c661f68c2f4b066752b32f06c131"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classSetArgumentsList.html">SetArgumentsList</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPreferred.html#a389a1c91c34ade8a75e27207a9a2c5c8">getSolution</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">get a copy of the solution computed by <a class="el" href="classPreferred.html#aa062709a818c1e9ae8ffeca02a3b0bd7" title="compute the algorithm prefSAT().">prefSAT()</a>  <a href="#a389a1c91c34ade8a75e27207a9a2c5c8"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>use it to compute the algorithm prefSAT </p>
<p>This class offers you an implementation of prefSAT algorithm. To use this class effectively you can code like this: </p>
<div class="fragment"><pre class="fragment">        <a class="code" href="classPreferred.html" title="use it to compute the algorithm prefSAT">Preferred</a>* pref=<span class="keyword">new</span> <a class="code" href="classPreferred.html#af11979bfbee65a273e2f8a0a3112442c" title="constructs a new instance computing prefSAT problems.">Preferred</a>();
        <span class="comment">//compute solution</span>
        pref-&gt;<a class="code" href="classPreferred.html#aa062709a818c1e9ae8ffeca02a3b0bd7" title="compute the algorithm prefSAT().">prefSAT</a>(&amp;someSet,&amp;someSet);
        <span class="comment">//print solutions</span>
        <span class="keywordflow">for</span> (<span class="keyword">auto</span> it=pref-&gt;<a class="code" href="classPreferred.html#a4aa065773cf8c442997c93167efcfa80" title="last element of the solution computed by the function prefSat().">begin</a>();it!=pref-&gt;<a class="code" href="classPreferred.html#a51a8c661f68c2f4b066752b32f06c131" title="last element of the solution computed by the function prefSat().">end</a>();it++){
                cout &lt;&lt; <span class="stringliteral">&quot;subset: &quot;</span> &lt;&lt; *it &lt;&lt; endl;
        }
        <span class="comment">//clean temporary variables to allows instance reuse</span>
        pref-&gt;cleanlabs();
</pre></div><p> If you are interested only in the inargs() arguments, there is an easier way to do it: </p>
<div class="fragment"><pre class="fragment">        <a class="code" href="classPreferred.html" title="use it to compute the algorithm prefSAT">Preferred</a>* pref=<span class="keyword">new</span> <a class="code" href="classPreferred.html#af11979bfbee65a273e2f8a0a3112442c" title="constructs a new instance computing prefSAT problems.">Preferred</a>();
        <span class="comment">//compute solution</span>
        pref-&gt;<a class="code" href="classPreferred.html#aa062709a818c1e9ae8ffeca02a3b0bd7" title="compute the algorithm prefSAT().">prefSAT</a>(&amp;someSet,&amp;someSet);
        <span class="comment">//print solutions</span>
        <a class="code" href="classSetArgumentsList.html" title="Class representing a vector of labelling assignment.">SetArgumentsList</a>* solution=pref-&gt;<a class="code" href="classPreferred.html#a389a1c91c34ade8a75e27207a9a2c5c8" title="get a copy of the solution computed by prefSAT()">getSolution</a>();
        cout &lt;&lt; <span class="stringliteral">&quot;solution: &quot;</span>&lt;&lt; *solution &lt;&lt; endl;
</pre></div><dl class="author"><dt><b>Author:</b></dt><dd>geryo </dd>
<dd>
Massimo Bono </dd></dl>
<dl class="date"><dt><b>Date:</b></dt><dd>10 June 2013 </dd></dl>

<p>Definition at line <a class="el" href="Preferred_8h_source.html#l00052">52</a> of file <a class="el" href="Preferred_8h_source.html">Preferred.h</a>.</p>
</div><hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="af11979bfbee65a273e2f8a0a3112442c"></a><!-- doxytag: member="Preferred::Preferred" ref="af11979bfbee65a273e2f8a0a3112442c" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classPreferred.html#af11979bfbee65a273e2f8a0a3112442c">Preferred::Preferred</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>constructs a new instance computing prefSAT problems. </p>
<p>Construct a new instance of <a class="el" href="classPreferred.html" title="use it to compute the algorithm prefSAT">Preferred</a> type. The newly created instance has the solution of a SAT problem set to an empty set by default. </p>

<p>Definition at line <a class="el" href="Preferred_8cpp_source.html#l00461">461</a> of file <a class="el" href="Preferred_8cpp_source.html">Preferred.cpp</a>.</p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a4aa065773cf8c442997c93167efcfa80"></a><!-- doxytag: member="Preferred::begin" ref="a4aa065773cf8c442997c93167efcfa80" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">PreferredIterator <a class="el" href="classPreferred.html#a4aa065773cf8c442997c93167efcfa80">Preferred::begin</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>last element of the solution computed by the function prefSat(). </p>
<p>Use this function to effectively iterate through out all the Labellings held by the caller instance. This function should be used to get the entire structure generated by <a class="el" href="classPreferred.html#aa062709a818c1e9ae8ffeca02a3b0bd7" title="compute the algorithm prefSAT().">prefSAT()</a>: while <a class="el" href="classPreferred.html#a389a1c91c34ade8a75e27207a9a2c5c8" title="get a copy of the solution computed by prefSAT()">getSolution()</a> returns only a little part of the structure generated by <a class="el" href="classPreferred.html#aa062709a818c1e9ae8ffeca02a3b0bd7" title="compute the algorithm prefSAT().">prefSAT()</a> (important to compose the SCC algorithm) this function aid you to access though out all the structure generated by <a class="el" href="classPreferred.html#aa062709a818c1e9ae8ffeca02a3b0bd7" title="compute the algorithm prefSAT().">prefSAT()</a>. You can easily do with somthing like this:</p>
<div class="fragment"><pre class="fragment">  <a class="code" href="classLabelling.html" title="Class representing a single labelling assignment.">Labelling</a> lab;
        <span class="keywordflow">for</span> (<span class="keyword">auto</span> it=pref.<a class="code" href="classPreferred.html#a4aa065773cf8c442997c93167efcfa80" title="last element of the solution computed by the function prefSat().">begin</a>(); it!=pref.<a class="code" href="classPreferred.html#a51a8c661f68c2f4b066752b32f06c131" title="last element of the solution computed by the function prefSat().">end</a>();it++){
                lab=*it;
                <span class="comment">//access to the single instance of Labelling</span>
        }
</pre></div><dl class="return"><dt><b>Returns:</b></dt><dd>an iterator to the last element of the solutions </dd></dl>

<p>Definition at line <a class="el" href="Preferred_8cpp_source.html#l00490">490</a> of file <a class="el" href="Preferred_8cpp_source.html">Preferred.cpp</a>.</p>

<p>Referenced by <a class="el" href="Preferred_8cpp_source.html#l00559">operator&lt;&lt;()</a>.</p>

</div>
</div>
<a class="anchor" id="a51a8c661f68c2f4b066752b32f06c131"></a><!-- doxytag: member="Preferred::end" ref="a51a8c661f68c2f4b066752b32f06c131" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">PreferredIterator <a class="el" href="classPreferred.html#a51a8c661f68c2f4b066752b32f06c131">Preferred::end</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>last element of the solution computed by the function prefSat(). </p>
<p>Use this function to effectively iterate through out all the Labellings held by the caller instance. This function should be used to get the entire structure generated by <a class="el" href="classPreferred.html#aa062709a818c1e9ae8ffeca02a3b0bd7" title="compute the algorithm prefSAT().">prefSAT()</a>: while <a class="el" href="classPreferred.html#a389a1c91c34ade8a75e27207a9a2c5c8" title="get a copy of the solution computed by prefSAT()">getSolution()</a> returns only a little part of the structure generated by <a class="el" href="classPreferred.html#aa062709a818c1e9ae8ffeca02a3b0bd7" title="compute the algorithm prefSAT().">prefSAT()</a> (important to compose the SCC algorithm) this function aid you to access though out all the structure generated by <a class="el" href="classPreferred.html#aa062709a818c1e9ae8ffeca02a3b0bd7" title="compute the algorithm prefSAT().">prefSAT()</a>. You can easily do with somthing like this:</p>
<div class="fragment"><pre class="fragment">  <a class="code" href="classLabelling.html" title="Class representing a single labelling assignment.">Labelling</a> lab;
        <span class="keywordflow">for</span> (<span class="keyword">auto</span> it=pref.<a class="code" href="classPreferred.html#a4aa065773cf8c442997c93167efcfa80" title="last element of the solution computed by the function prefSat().">begin</a>(); it!=pref.<a class="code" href="classPreferred.html#a51a8c661f68c2f4b066752b32f06c131" title="last element of the solution computed by the function prefSat().">end</a>();it++){
                lab=*it;
                <span class="comment">//access to the single instance of Labelling</span>
        }
</pre></div><dl class="return"><dt><b>Returns:</b></dt><dd>an iterator to the last element of the solutions </dd></dl>

<p>Definition at line <a class="el" href="Preferred_8cpp_source.html#l00513">513</a> of file <a class="el" href="Preferred_8cpp_source.html">Preferred.cpp</a>.</p>

<p>Referenced by <a class="el" href="Preferred_8cpp_source.html#l00559">operator&lt;&lt;()</a>.</p>

</div>
</div>
<a class="anchor" id="a389a1c91c34ade8a75e27207a9a2c5c8"></a><!-- doxytag: member="Preferred::getSolution" ref="a389a1c91c34ade8a75e27207a9a2c5c8" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classSetArgumentsList.html">SetArgumentsList</a> * <a class="el" href="classPreferred.html#a389a1c91c34ade8a75e27207a9a2c5c8">Preferred::getSolution</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>get a copy of the solution computed by <a class="el" href="classPreferred.html#aa062709a818c1e9ae8ffeca02a3b0bd7" title="compute the algorithm prefSAT().">prefSAT()</a> </p>
<p>This function is the main interface of the class <a class="el" href="classPreferred.html" title="use it to compute the algorithm prefSAT">Preferred</a>. Thanks to this class you can easily get a <b>copy</b> of the solution computed by <a class="el" href="classPreferred.html#aa062709a818c1e9ae8ffeca02a3b0bd7" title="compute the algorithm prefSAT().">prefSAT()</a>; you can use this function like this:</p>
<div class="fragment"><pre class="fragment">        <a class="code" href="classPreferred.html" title="use it to compute the algorithm prefSAT">Preferred</a> pref=<a class="code" href="classPreferred.html#af11979bfbee65a273e2f8a0a3112442c" title="constructs a new instance computing prefSAT problems.">Preferred</a>();
        <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a>* SetA=<span class="keyword">new</span> <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a>();
        <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a>* SetC=<span class="keyword">new</span> <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a>();
        <span class="comment">//fill SetA and SetC...</span>
        pref.<a class="code" href="classPreferred.html#aa062709a818c1e9ae8ffeca02a3b0bd7" title="compute the algorithm prefSAT().">prefSAT</a>(SetA,SetC);
        <a class="code" href="classSetArgumentsList.html" title="Class representing a vector of labelling assignment.">SetArgumentsList</a>* solution=pref.<a class="code" href="classPreferred.html#a389a1c91c34ade8a75e27207a9a2c5c8" title="get a copy of the solution computed by prefSAT()">getSolution</a>();
        cout &lt;&lt; <span class="stringliteral">&quot;The solution is &quot;</span>&lt;&lt; *solution &lt;&lt; endl;
</pre></div><p>Note that you don't have to create a clone of the solution, because the solution already takes care of it</p>
<dl class="return"><dt><b>Returns:</b></dt><dd>A Set of <a class="el" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a> holding the solution of <a class="el" href="classPreferred.html#aa062709a818c1e9ae8ffeca02a3b0bd7" title="compute the algorithm prefSAT().">prefSAT()</a> </dd></dl>

<p>Definition at line <a class="el" href="Preferred_8cpp_source.html#l00536">536</a> of file <a class="el" href="Preferred_8cpp_source.html">Preferred.cpp</a>.</p>

<p>References <a class="el" href="SetArgumentsList_8cpp_source.html#l00214">SetArgumentsList::push_back()</a>.</p>

</div>
</div>
<a class="anchor" id="aa062709a818c1e9ae8ffeca02a3b0bd7"></a><!-- doxytag: member="Preferred::prefSAT" ref="aa062709a818c1e9ae8ffeca02a3b0bd7" args="(SetArguments *, SetArguments *)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classPreferred.html#aa062709a818c1e9ae8ffeca02a3b0bd7">Preferred::prefSAT</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classSetArguments.html">SetArguments</a> *&#160;</td>
          <td class="paramname"><em>the_a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classSetArguments.html">SetArguments</a> *&#160;</td>
          <td class="paramname"><em>the_c</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>compute the algorithm <a class="el" href="classPreferred.html#aa062709a818c1e9ae8ffeca02a3b0bd7" title="compute the algorithm prefSAT().">prefSAT()</a>. </p>
<p>Use this function to compute the prefSAT algorithm. You can easily do it with a code like this: </p>
<div class="fragment"><pre class="fragment">        <a class="code" href="classPreferred.html" title="use it to compute the algorithm prefSAT">Preferred</a>* pref=<span class="keyword">new</span> <a class="code" href="classPreferred.html#af11979bfbee65a273e2f8a0a3112442c" title="constructs a new instance computing prefSAT problems.">Preferred</a>();
        <span class="comment">//compute solution</span>
        pref-&gt;<a class="code" href="classPreferred.html#aa062709a818c1e9ae8ffeca02a3b0bd7" title="compute the algorithm prefSAT().">prefSAT</a>(&amp;someSet,&amp;someSet);
        <span class="comment">//print solutions</span>
        <span class="keywordflow">for</span> (<span class="keyword">auto</span> it=pref-&gt;<a class="code" href="classPreferred.html#a4aa065773cf8c442997c93167efcfa80" title="last element of the solution computed by the function prefSat().">begin</a>();it!=pref-&gt;<a class="code" href="classPreferred.html#a51a8c661f68c2f4b066752b32f06c131" title="last element of the solution computed by the function prefSat().">end</a>();it++){
                cout &lt;&lt; <span class="stringliteral">&quot;subset: &quot;</span> &lt;&lt; *it &lt;&lt; endl;
        }
        <span class="comment">//clean temporary variables to allows instance reuse</span>
        pref-&gt;cleanlabs();
</pre></div><dl class="pre"><dt><b>Precondition:</b></dt><dd><ul>
<li>the_a has been correctly built and filled; </li>
<li>the_c has been correctly built and filled; </li>
</ul>
</dd></dl>
<dl class="post"><dt><b>Postcondition:</b></dt><dd><ul>
<li>the field named "labellings" of the caller <a class="el" href="classPreferred.html" title="use it to compute the algorithm prefSAT">Preferred</a> structure contains the solution computed by the algorithm</li>
</ul>
</dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">the_a</td><td>the first set required by the algorithm </td></tr>
    <tr><td class="paramname">the_c</td><td>the second set required by the algorithm </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="Preferred_8cpp_source.html#l00374">374</a> of file <a class="el" href="Preferred_8cpp_source.html">Preferred.cpp</a>.</p>

<p>References <a class="el" href="SATFormulae_8cpp_source.html#l00024">SATFormulae::appendOrClause()</a>, <a class="el" href="OrClause_8cpp_source.html#l00046">OrClause::appendVariable()</a>, <a class="el" href="SetArguments_8cpp_source.html#l00103">SetArguments::begin()</a>, <a class="el" href="SetArguments_8cpp_source.html#l00066">SetArguments::cardinality()</a>, <a class="el" href="SATFormulae_8cpp_source.html#l00068">SATFormulae::clone()</a>, <a class="el" href="Labelling_8cpp_source.html#l00213">Labelling::clone()</a>, <a class="el" href="Labelling_8cpp_source.html#l00203">Labelling::empty()</a>, <a class="el" href="SetArguments_8cpp_source.html#l00112">SetArguments::end()</a>, <a class="el" href="Argument_8cpp_source.html#l00035">Argument::getName()</a>, <a class="el" href="Labelling_8cpp_source.html#l00176">Labelling::inargs()</a>, and <a class="el" href="SetArguments_8cpp_source.html#l00249">SetArguments::setminus()</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>src/<a class="el" href="Preferred_8h_source.html">Preferred.h</a></li>
<li>src/<a class="el" href="Preferred_8cpp_source.html">Preferred.cpp</a></li>
</ul>
</div><!-- contents -->
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="classPreferred.html">Preferred</a>      </li>

    <li class="footer">Generated on Thu Oct 24 2013 17:38:30 for SemOpt by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>
   </ul>
 </div>


</body>
</html>
